package org.bmo;

import lejos.nxt.Button;
import lejos.nxt.Motor;
import lejos.nxt.UltrasonicSensor;

public class Dicer extends Thread {
	
    private static Motor dicerMotor;
    protected boolean threatShouldStop = false;

	public Dicer(Motor m1) {
		dicerMotor=m1;
		dicerMotor.setPower(100);
	}

	public void run() {
		liftUp();
		fallDown();
	}
	
	private void liftUp(){
		
		dicerMotor.setSpeed(900);		
		dicerMotor.rotateTo(94);
	}

	private void fallDown(){
		
		dicerMotor.setPower(100);
		dicerMotor.rotateTo(0);
	}
	
	public synchronized void close() {
		this.threatShouldStop = true;
	}
	
	protected synchronized boolean isClosing() {
		return this.threatShouldStop;
	}
	
}
